import tools from './tools';
// import img from './assets/logo.png';
// console.log(img.src);
// console.log(tools);
if (process.env.NODE_ENV !== 'production') {
    console.log('Looks like we are in development mode!');
}

// 异步加载工具方法
async function loadTools() {
    const { dateFmt } = await import(/* webpackChunkName: "myDate" */ './date.js');
    return dateFmt;
}

loadTools().then(dateFmt => {
    console.log(dateFmt(new Date(), ':'));
});

// 异步加载lodash
async function getComponent() {
    const { default: _ } = await import(/* webpackChunkName: "lodash" */ 'lodash');
    const element = document.createElement('h3');
    element.innerHTML = _.join(['Hello', 'webpack'], ' ');
    return element;
}

getComponent().then(component => {
    document.body.appendChild(component);
});


// 异步加载axios
async function loadAxios() {
    const axios = await import(/* webpackChunkName:"axios" */ 'axios');
    return axios;
}

loadAxios().then(axios => {
    axios.get('http://106.13.182.88:8081/get.php').then(({ data }) => {
        console.log(data);
    });
})
